﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ItemsList.aspx.cs" Inherits="RCREEE.Web.ItemsList"
    ValidateRequest="false" MasterPageFile="~/Site.Master" Culture="auto" meta:resourcekey="PageResource1"
    UICulture="auto" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Items</title>
    <style type="text/css">
        .BulletedListCssClass
        {
            display: block;
            width: 100%;
        }
    </style>
    <script type="text/javascript">
        $().ready(function () {
            $('#dialogContent').dialog({
                autoOpen: false,
                modal: true,
                bgiframe: true,
                title: "Confirm Delete",
                width: 300,
                height: 200
            });
        });

        function openDeletePopup(uniqueID) {
            $('#dialogContent').dialog('option', 'buttons',
                {
                    "OK": function () { __doPostBack(uniqueID, ''); $(this).dialog("close"); },
                    "Cancel": function () { $(this).dialog("close"); }
                });

            $('#dialogContent').dialog('open');

            return false;
        }

    </script>
    <div id="header">
        <div id="section">
            <table width="100%">
                <tr>
                    <td width="20%" align="center" valign="middle">
                        <img src="Images/LogoRCREEE_Transparent.png" width="200px" />
                    </td>
                    <td width="60%" align="center" valign="middle">
                        <img src="Images/areeed-ba-txtr.png" width="600px" />
                    </td>
                    <td width="25%" align="center" valign="top">
                        <img src="Images/las-logo.png" width="85px" />
                    </td>
                </tr>
            </table>
        </div>
        <ul>
            <li><a href="Default.aspx">Home</a></li>
            <li><a href="Index.aspx">Index</a></li>
            <li><a href="Topics.aspx">Topics</a></li>
            <li><a href="CountrySelector.aspx">Countries</a></li>
            <li><a href="Aboutus.aspx">About Us</a></li>
            <li><a href="contactus.aspx">Contact us</a></li>
        </ul>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <center>
        <div id="form1" runat="server">
            <div id="dialogContent" style="font-size: small">
                <p>
                    Are you sure you want to delete?</p>
            </div>
            <ajaxToolkit:ToolkitScriptManager runat="server" ID="scriptManager" CombineScripts="True" />
            <asp:UpdateProgress ID="Up1" runat="Server" AssociatedUpdatePanelID="updatePanel1">
                <ProgressTemplate>
                    <div id="progressBackgroundFilter">
                    </div>
                    <div id="processMessage">
                        Loading...<br />
                        <br />
                        <img alt="Loading..." src="Images/Loading.gif" />
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>
            <asp:UpdatePanel ID="updatePanel1" runat="server">
                <ContentTemplate>
                    <asp:Label runat="server" ID="lblItemName" Font-Bold="True" Font-Size="23pt" meta:resourcekey="lblItemNameResource1" />
                    <asp:Label runat="server" ID="lblErrors" ForeColor="Red" meta:resourcekey="lblErrorsResource1" />
                    <div style="width: 100%">
                        <asp:Repeater runat="server" ID="rpt" OnItemDataBound="Rpt_ItemDataBound">
                            <HeaderTemplate>
                                <th>
                                    <asp:Label ID="Label1" runat="server" Text=" Country" Width="150px" meta:resourcekey="Label1Resource1" />
                                </th>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <td>
                                    <asp:Label runat="server" ID="lblCounry" Width="150px" meta:resourcekey="lblCounryResource1" />
                                </td>
                                <td>
                                    <div style="width: 100%">
                                        <asp:Repeater runat="server" ID="rptMultiValueItems">
                                            <ItemTemplate>
                                                <td>
                                                    <asp:Label runat="server" ID="lblItemValue" Text='<%# Eval("Value") %>' Width="150px"
                                                        meta:resourcekey="lblItemValueResource1" />
                                                </td>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </div>
                                </td>
                            </ItemTemplate>
                        </asp:Repeater>
                    </div>
                    <br />
                    <div style="width: 250px">
                        <asp:Label runat="server" ID="lblCountry" Text="Country: " />
                        <asp:DropDownList ID="ddlCountries" runat="server" DataValueField="ID" DataTextField="Name"
                            AutoPostBack="True" OnSelectedIndexChanged="ddlCountries_SelectedIndexChanged"
                            meta:resourcekey="ddlCountriesResource1">
                        </asp:DropDownList>
                    </div>
                    <br />
                    <asp:MultiView ID="MultiView" runat="server" ActiveViewIndex="0">
                        <asp:View ID="viewAll" runat="server">
                            <div style="width: 100%">
                                <asp:GridView runat="server" ID="grdAllCountriesItems" OnRowDataBound="GrdCountryItems_OnRowDataBound"
                                    DataKeyNames="MultiValueItemId" OnSelectedIndexChanged="GrdAllCountriesItems_SelectedIndexChanged"
                                    AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="Horizontal"
                                    CssClass="style1" Width="100%" EnableModelValidation="True" meta:resourcekey="grdAllCountriesItemsResource1">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Name" Visible="False" meta:resourcekey="TemplateFieldResource1">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkname" runat="server" Text='select' CommandName="Select" meta:resourcekey="lnknameResource1"></asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="" meta:resourcekey="TemplateFieldResource2">
                                            <ItemTemplate>
                                                <table>
                                                    <tr>
                                                        <td valign="middle" >
                                                            <asp:Image runat="server" ID="imgCountryFlag" Width="35px" Height="35px" />
                                                            <asp:Label runat="server" ID="lblCountryName" Font-Bold="True" Height="35px" Style="vertical-align: middle;
                                                                text-align: center;" meta:resourcekey="lblCountryNameResource1" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td dir='<% GetPageDirection(); %>'>
                                                            <asp:BulletedList runat="server" ID="bulletedlistMultiValueItems" DataTextField="Value"
                                                                CssClass="BulletedListCssClass" Width="650px" meta:resourcekey="bulletedlistMultiValueItemsResource1"
                                                                Style="direction: inherit;">
                                                            </asp:BulletedList>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <br />
                                            </ItemTemplate>
                                            <ItemStyle Wrap="True" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <FooterStyle BackColor="#0268b0" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#0268b0" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#CCCCCC" ForeColor="#990000" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EAEAEA" ForeColor="#333333" />
                                    <SelectedRowStyle BackColor="#CCCCCC" Font-Bold="True" ForeColor="#990000" />
                                </asp:GridView>
                            </div>
                        </asp:View>
                        <asp:View ID="viewCountry" runat="server">
                            <div style="width: 100%">
                                <%-- <div style="width: 250px">
                                    <asp:Label runat="server" ID="Label2" Text="Language: " />
                                    <asp:DropDownList runat="server" ID="ddlLanguages" AutoPostBack="true" OnSelectedIndexChanged="DdlLanguages_SelectedIndexChanged"
                                        DataValueField="Key" DataTextField="Value" />
                                </div>--%>
                                <%-- Commented for Demo Purpose--%>
                                <%--<div style="background-color: #eeeeee; text-align: top; height: 24px; width: 100%">
                                   
                                    <div style="float: left; background-color: #eeeeee;">
                                        <asp:Label runat="server" ID="lblItems" Text="Items" meta:resourcekey="lblItemsResource1" />
                                    </div>
                                    <div style="float: right; background-color: #eeeeee;">
                                        
                                    </div>--%>
                            </div>
                            <asp:Button runat="server" ID="btnAddItemValue" Text="Add" OnClick="BtnAddItemValue_Clicked"
                                meta:resourcekey="btnAddItemValueResource1" />
                            <div style="text-align: left; color: Black;">
                                <%--Grid View is Hidden for Demo Purpose--%>
                                <asp:Panel ID="pnlItems" runat="server" GroupingText="Items">
                                    <asp:GridView runat="server" ID="gridCountryItems" DataKeyNames="MultiValueItemDataValueId"
                                        OnSelectedIndexChanged="GrdCountryItems_SelectedIndexChanged" AutoGenerateColumns="False"
                                        ForeColor="#333333" GridLines="None" CssClass="style1" Width="100%" OnRowDeleting="GridCountryItems_RowDeleting"
                                        EnableModelValidation="True" meta:resourcekey="gridCountryItemsResource1" OnRowDataBound="GridCountryItems_RowDataBound"
                                        Visible="false">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Items" meta:resourcekey="TemplateFieldResource3">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="lnkname" runat="server" Text='<%# Eval("Value") %>' CommandName="Select"
                                                        meta:resourcekey="lnknameResource2"></asp:LinkButton>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Items" Visible="False" meta:resourcekey="TemplateFieldResource4">
                                                <ItemTemplate>
                                                    <asp:Label runat="server" ID="lblItemValue" Text='<%# Eval("Value") %>' meta:resourcekey="lblItemValueResource2" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Delete" meta:resourcekey="TemplateFieldResource5"
                                                ItemStyle-HorizontalAlign="Right" ItemStyle-Width="75px" HeaderStyle-HorizontalAlign="Right"
                                                HeaderStyle-Width="75px">
                                                <ItemTemplate>
                                                    <asp:Button ID="btnDel" runat="server" Text='Delete' CommandName="Delete" meta:resourcekey="lnkDeleteResource1"
                                                        OnClientClick="javascript:return openDeletePopup(this.name);"></asp:Button>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <FooterStyle BackColor="#0268b0" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#0268b0" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#CCCCCC" ForeColor="#990000" HorizontalAlign="Center" />
                                        <RowStyle BackColor="#EAEAEA" ForeColor="#333333" />
                                        <SelectedRowStyle BackColor="#CCCCCC" Font-Bold="True" ForeColor="#990000" />
                                    </asp:GridView>
                                    <asp:ListView ID="lvMultiViewItemValues" runat="server" EmptyDataText="No data Available for this language">
                                        <LayoutTemplate>
                                            <ul>
                                                <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
                                            </ul>
                                        </LayoutTemplate>
                                        <ItemTemplate>
                                            <li>
                                                <asp:Label ID="lblValue" Text='<%# Container.DataItem %>' runat="server" />
                                            </li>
                                        </ItemTemplate>
                                    </asp:ListView>
                                </asp:Panel>
                            </div>
                            <br />
                            <asp:FormView ID="fvItems" runat="server" CellPadding="4" AllowPaging="True" EnableModelValidation="True"
                                ForeColor="#333333" DataKeyNames="MultiValueItemDataValueId" Width="100%" meta:resourcekey="fvItemsResource1"
                                OnDataBound="fvItems_OnDataBound">
                                <EditRowStyle BackColor="#2461BF" />
                                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                <ItemTemplate>
                                    <asp:Label ID="lblItem" runat="server" Text='<%# Eval("Value") %>' meta:resourcekey="lblItemResource1"></asp:Label>
                                    <asp:Button runat="server" ID="btnEdit" Text="Edit" OnClick="BtnEditItem_Clicked"
                                        meta:resourcekey="btnEditResource1" />
                                </ItemTemplate>
                                <InsertItemTemplate>
                                    <asp:Label runat="server" ID="Label2" Text="Language: " />
                                    <asp:DropDownList runat="server" ID="ddlLanguages" DataValueField="Key" DataTextField="Value" />
                                    <asp:TextBox ID="txtItem" runat="server" meta:resourcekey="txtItemResource1"></asp:TextBox>
                                    <asp:Button runat="server" ID="btnSave" Text="Save" OnClick="BtnSaveItem_Clicked"
                                        meta:resourcekey="btnSaveResource1" />
                                    <asp:Button runat="server" ID="btnCancelSaveItem" Text="Cancel" OnClick="BtnCancel_Clicked" />
                                </InsertItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtEditItem" runat="server" Text='<%# Eval("Value") %>' meta:resourcekey="txtEditItemResource1"></asp:TextBox>
                                    <asp:Button runat="server" ID="btnSaveChange" Text="Save" OnClick="BtnSaveItemChange_Clicked"
                                        meta:resourcekey="btnSaveChangeResource1" />
                                    <asp:Button runat="server" ID="btnCancelSaveItemChange" Text="Cancel" OnClick="BtnCancel_Clicked" />
                                </EditItemTemplate>
                                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#EFF3FB" />
                            </asp:FormView>
                            <br />
                            <br />
                            <%-- Commented for Demo Purpose--%>
                            <%--<div style="background-color: #eeeeee; text-align: top; height: 24px; width: 100%">
                                   
                                    <div style="float: left; background-color: #eeeeee;">
                                        <asp:Label runat="server" ID="lblCadres" Text="Cadres" meta:resourcekey="lblCadresResource1" />
                                    </div
                                    <div style="float: right; background-color: #eeeeee;">
                                       
                                    </div>
                                </div>>--%>
                            <asp:Button runat="server" ID="btnAddCadre" Text="Add" OnClick="BtnAddCadre_Clicked"
                                meta:resourcekey="btnAddCadreResource1" />
                            <div style="text-align: left; color: Black;">
                                <asp:Panel ID="pnlCadres" runat="server" GroupingText="Cadres">
                                    <asp:FormView ID="fvCadres" runat="server" CellPadding="4" AllowPaging="True" EnableModelValidation="True"
                                        ForeColor="#333333" OnPageIndexChanging="FrmViewCadres_PageIndexChanging" DataKeyNames="CadreId"
                                        Width="100%" meta:resourcekey="fvCadresResource1" OnDataBound="fvCadres_OnDataBound">
                                        <EditRowStyle BackColor="#EFF3FB" />
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblCadre" runat="server" Text='<%# Eval("CadreValue") %>' meta:resourcekey="lblCadreResource1"></asp:Label>
                                            <asp:Button runat="server" ID="btnEdit" Text="Edit" OnClick="BtnEdit_Clicked" meta:resourcekey="btnEditResource2" />
                                            <asp:Button runat="server" ID="btnDeleteCadre" Text="Delete" OnClick="BtnDeleteCadre_Clicked"
                                                meta:resourcekey="btnDeleteCadreResource1" OnClientClick="javascript:return openDeletePopup(this.name);" />
                                        </ItemTemplate>
                                        <InsertItemTemplate>
                                            <asp:Label runat="server" ID="Label2" Text="Language: " />
                                            <asp:DropDownList runat="server" ID="ddlLanguages" DataValueField="Key" DataTextField="Value" />
                                            <asp:TextBox ID="editorCadre" runat="server" Rows="20" Width="100%" TextMode="MultiLine"></asp:TextBox>
                                            <ajaxToolkit:HtmlEditorExtender ID="htmlEditorExtender1" TargetControlID="editorCadre"
                                                runat="server">
                                            </ajaxToolkit:HtmlEditorExtender>
                                            <asp:Button runat="server" ID="btnSave" Text="Save" OnClick="BtnSave_Clicked" meta:resourcekey="btnSaveResource2" />
                                            <asp:Button runat="server" ID="btnCancelSave" Text="Cancel" OnClick="BtnCancelCadre_Clicked" />
                                        </InsertItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="editorCadreEdit" runat="server" Text='<%# Eval("CadreValue") %>'
                                                meta:resourcekey="editorCadreEditResource1" Rows="20" Width="100%" TextMode="MultiLine"></asp:TextBox>
                                            <ajaxToolkit:HtmlEditorExtender ID="htmlEditorExtender1" TargetControlID="editorCadreEdit"
                                                runat="server">
                                            </ajaxToolkit:HtmlEditorExtender>
                                            <asp:Button runat="server" ID="btnSaveChange" Text="Save" OnClick="BtnSaveChange_Clicked"
                                                meta:resourcekey="btnSaveChangeResource2" />
                                            <asp:Button runat="server" ID="btnCancelSaveChange" Text="Cancel" OnClick="BtnCancelCadre_Clicked" />
                                        </EditItemTemplate>
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <RowStyle BackColor="#EFF3FB" />
                                    </asp:FormView>
                                </asp:Panel>
                            </div>
                            </div>
                        </asp:View>
                    </asp:MultiView>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </center>
</asp:Content>
